home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / software / temacd / tiny / tpf-6[1].5.126.exe / Tiny Firewall 2005.msi / webui.dll / COMMON / HTML-TOOLS.JS < prev    next >
Encoding:
JavaScript  |  2005-08-17  |  41.1 KB  |  1,174 lines

  1. /*//////////////////////////////////////////////////////////////////////
  2. Filename:          html-tools.js
  3. Company Name:      Computer Associates International, Inc.
  4. Legal Copyright: Copyright (c) Computer Associates International, Inc.
  5. Author:          Marek Matus (marek.matus@ca.com)
  6. Product:          Tiny Firewall
  7. Description:      javascript code - help functions
  8. ///////////////////////////////////////////////////////////////////////*/
  9.  
  10.  
  11. // Visualize or hide given object
  12. function hideObject( obj, hide )
  13. {
  14.     if (obj.style != null && obj.style.display != null)
  15.         obj.style.display = hide ? "none" : "inline";
  16. }
  17.  
  18. // Visualize or hide given object and all his children
  19. function setContainerHidden(obj, hide)
  20. {
  21.     // call setContainerHidden for all children
  22.     for (var i = 0; i < obj.childNodes.length; i++)
  23.         setContainerHidden(obj.childNodes[i], hide);
  24.  
  25.     // if it is possible set this object to hidden
  26.     if (obj.style != null && obj.style.display != null)
  27.         obj.style.display = hide ? "none" : "inline";
  28. }
  29.  
  30. // Enables or disables given object and all his children
  31. function setContainerEnabled(obj, enabled)
  32. {
  33.     // call setContainerEnabled for all children
  34.     for (var i = 0; i < obj.childNodes.length; i++)
  35.         setContainerEnabled(obj.childNodes[i], enabled);
  36.  
  37.     // if it is possible set this object to enabled
  38.     if (obj.disabled != null)
  39.     {
  40.         obj.disabled = !enabled;
  41.     }
  42. }
  43.  
  44. // Returns object with ID 'objId'
  45. function getObj(objId)
  46. {
  47.     if (document.getElementById)
  48.         return document.getElementById(objId);
  49.     else if (document.all)
  50.         return document.all[objId];
  51.     else
  52.         return null;
  53. }
  54.  
  55. // Returns position of input object in parent's window
  56. function getWinPosition(obj)
  57. {
  58.     if (obj.offsetParent)
  59.     {
  60.         var pos = getWinPosition(obj.offsetParent);
  61.         pos.top += obj.offsetTop;
  62.         pos.left += obj.offsetLeft;
  63.  
  64.         return pos;
  65.     }
  66.     else
  67.     {
  68.         var pos = new Object();
  69.         pos.top = obj.offsetTop ? obj.offsetTop : 0;
  70.         pos.left = obj.offsetLeft ? obj.offsetLeft : 0;
  71.  
  72.         return pos;
  73.     }
  74. }
  75.  
  76. // menuchange - handles style change when clicking on the menu (draws black rectangle) - moved from users.js
  77. function menuchange(td,MO)
  78. {
  79.     if (MO==1)
  80.         td.className = "menuleft_sel";
  81.  
  82.     if (MO==0)
  83.         td.className = "menuleft";
  84. }
  85.  
  86. function setFocus( obj )
  87. {
  88.     // if it is text box then select whole text
  89.     try
  90.     {
  91.         obj.select();
  92.     }
  93.     catch (e)
  94.     {
  95.     }
  96.  
  97.     try
  98.     {
  99.         obj.focus();
  100.     }
  101.     catch (e)
  102.     {
  103.     }
  104. }
  105.  
  106. ///////////////////////////////////////////////////////////////////////////////////////
  107. /////////////// FLOAT MENU FUNCTIONS //////////////////////////////////////////////////
  108. ///////////////////////////////////////////////////////////////////////////////////////
  109. var visibleMenu = null;
  110.  
  111. function closeCurrentFloatMenu()
  112. {
  113.     if ( visibleMenu != null )
  114.     {
  115.         toggleFloatMenu(visibleMenu.callObj, visibleMenu.menuId);
  116.     }
  117. }
  118.  
  119.  
  120. // Shows or hides (if it is already shown) flow menu
  121. function toggleFloatMenu(tg, menuId, strTable, strScrollWrapper)
  122. {
  123.     var action = "hide";
  124.     var menu = getObj(menuId);
  125.     var tmpIFrame = getObj("float_menu_help_frame");
  126.  
  127.     // check the action
  128.     if ((visibleMenu == null) || (visibleMenu.callObj != tg))
  129.         action = "show";
  130.  
  131.     if (action == "show")
  132.     {
  133.         // hide old visibleMenu
  134.         if (visibleMenu)
  135.         {
  136.             visibleMenu.style.display = "none";
  137.             if ( tmpIFrame )
  138.                 tmpIFrame.style.display = "none";
  139.         }
  140.  
  141.         // hide old visibleMenu.callObj
  142.         if (visibleMenu && visibleMenu.callObj != null)
  143.         {
  144.             visibleMenu.callObj.style.backgroundColor = "";
  145.             visibleMenu.callObj.style.color = "";
  146.             visibleMenu.callObj = null;
  147.         }
  148.  
  149.         // set new visibleMenu and callObj
  150.         //tg.style.backgroundColor = "blue";
  151.         //tg.style.color = "#c0c0c0";
  152.         visibleMenu = menu;
  153.         visibleMenu.callObj = tg;
  154.         visibleMenu.menuId = menuId;
  155.  
  156.         // check window width
  157.         var winWidth = window.innerWidth ? window.innerWidth + window.scrollLeft : document.body.offsetWidth + document.body.scrollLeft - 20;
  158.  
  159.         // set the position of the menu
  160.         // if table is wrapped with div with scrollbars then correction is needed!
  161.         if ( strScrollWrapper && getObj(strScrollWrapper) )
  162.         {
  163.             menu.style.left = tg.parentNode.offsetLeft + getTablePos(strTable).left - getObj(strScrollWrapper).scrollLeft;
  164.             menu.style.top = tg.parentNode.offsetTop + tg.offsetTop + tg.offsetHeight + getTablePos(strTable).top - getObj(strScrollWrapper).scrollTop;
  165.  
  166.             if ( menu.style.height )
  167.             {
  168.                 // adjust top of menu to not show scroll bars. It is possible only if we know height of menu
  169.                 if ( (parseInt(menu.style.height) + parseInt(menu.style.top)) > parseInt(document.body.scrollHeight ))
  170.                 {
  171.                     menu.style.top = tg.parentNode.offsetTop + tg.offsetTop  + getTablePos(strTable).top - getObj(strScrollWrapper).scrollTop - parseInt(menu.style.height);
  172.                 }
  173.             }
  174.  
  175.             if ( parseInt(menu.style.left) < 0 )
  176.                 menu.style.left = 0;
  177.         }
  178.         else
  179.         {
  180.             menu.style.left = tg.parentNode.offsetLeft + getTablePos(strTable).left;
  181.             menu.style.top = tg.parentNode.offsetTop + tg.offsetTop + tg.offsetHeight + getTablePos(strTable).top;
  182.         }
  183.  
  184.         // show the menu
  185.         menu.style.display = "block";
  186.         tg.style.backgroundColor = "#b2b2b2"
  187.  
  188.         // correct X position if the menu is out of the window
  189.         if (menu.offsetLeft + menu.offsetWidth > winWidth)
  190.             menu.style.left = winWidth - menu.offsetWidth;
  191.  
  192.         // show help iframe -> it is needed if float menu is over edit controls
  193.         if ( tmpIFrame )
  194.         {
  195.             tmpIFrame.style.left = menu.style.left;
  196.             tmpIFrame.style.top = menu.style.top;
  197.             tmpIFrame.style.width = menu.offsetWidth + "px";
  198.             tmpIFrame.style.height = menu.offsetHeight + "px";
  199.             tmpIFrame.style.display = "block";
  200.         }
  201.     }
  202.     else
  203.     {
  204.         tg.style.backgroundColor = "";
  205.         //tg.style.color = "";
  206.         visibleMenu.callObj = null;
  207.         visibleMenu = null;
  208.  
  209.         // hide the menu
  210.         menu.style.display = "none";
  211.         if ( tmpIFrame )
  212.             tmpIFrame.style.display = "none";
  213.     }
  214. }
  215.  
  216. // Returns position of rules table on the screen
  217. function getTablePos(strTable)
  218. {
  219.     // the position is not cached -> get it
  220.     var table = getObj( strTable );
  221.     if (table)
  222.         tablePos = getWinPosition(table);
  223.     else
  224.         alert("no found obj");
  225.  
  226.     return tablePos;
  227. }
  228.  
  229. function insertPageTitle(strImg, strTitle, bShowStaticUserText, strTip, bNotShowUsers, bNotLoggedAccess, bNotAddMenu)
  230. {
  231.     if ( external.CfgRegValueString("design") == 'std_menu' && !bNotAddMenu)
  232.         insertTopMenu();
  233.  
  234.     if ( !bNotLoggedAccess )
  235.         logPageAccess();
  236.  
  237.     if (( external.CfgRegValueString("design") != 'bt_menu') || bNotAddMenu )
  238.     {
  239.         document.write('<table class="hdr_user">');
  240.             document.write('<tr>');
  241.  
  242.                 document.write('<th>');
  243.                     document.write('<h3 style="display: inline">');
  244.                         if ( strImg )
  245.                             document.write('<IMG alt="" src="../img/' + strImg + '" border="0" align="absmiddle"> ');
  246.                     document.write(strTitle + '</h3>');
  247.  
  248.                     if ( strTip )
  249.                     {
  250.                         document.write('<span style="width: 10px;"></span>');
  251.                         document.write('<a href="#" onclick="showhelp()">');
  252.                             document.write('<img alt="' + strTip + '" src="../img/help16.gif" border="0" align="absmiddle">');
  253.                         document.write('</a>');
  254.                     }
  255.                 document.write('</th>');
  256.  
  257.                 document.write('<td align="right" class="heading_guard">');
  258.  
  259.                 if ( external.CfgRegValueString("design") != 'bt_menu')
  260.                 {
  261.  
  262.                     if ( isUsrSelectVisible() && !bNotShowUsers)
  263.                     {
  264.                         document.write('<img src="../img/ico-usr.gif" width="33" height="28" border="0" alt="" align="absmiddle">');
  265.                         //document.write('<img src="../img/ico-sm-usr.gif" width="16" height="16" border="0" alt="" align="absmiddle">');
  266.  
  267.                         if (bShowStaticUserText)
  268.                         {
  269.                             document.write('<span style="font-size: 12px">');
  270.                             document.write(window.external.LoggedUser)
  271.                             document.write('</span>');
  272.                         }
  273.                         else
  274.                             document.write(GetUsersHtml());
  275.                     }
  276.                 }
  277.                 document.write('</td>');
  278.             document.write('</tr>');
  279.         document.write('</table>');
  280.         document.write('<br>');
  281.     }
  282.  
  283.     if ( external.CfgRegValueString("design") == 'bt_menu')
  284.     {
  285.         try
  286.         {
  287.             parent.htop.addUserCombo( bShowStaticUserText, bNotShowUsers );
  288.         }
  289.         catch (e)
  290.         {
  291.         }
  292.     }
  293.  
  294. }
  295.  
  296. function showhelp(bContent)
  297. {
  298.     var what = "";
  299.  
  300.     var strLink = ( isProVersion()?
  301.                     'http://www.tinysoftware.com/home/tiny2?pg=resources&book_name=tf2005pro_manual&intro_topic=tf6_pro_ovw' :
  302.                     'http://www.tinysoftware.com/home/tiny2?pg=resources&book_name=tpf2005_manual&intro_topic=tf6std_ovw');
  303.  
  304.     if ( !bContent )
  305.     {
  306.         try
  307.         {
  308.             //what = getContextHelpRef();
  309.         }
  310.         catch (e)
  311.         {
  312.         }
  313.     }
  314.  
  315.     //window.open(window.external.InstallDir + 'help.html' + (what? '#' + what : ''),'help', 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=630px, height=600px, topmargin=10px, leftmargin=10px');
  316.     window.open(strLink,'_blank');
  317. }
  318.  
  319. /*function showhelp(bContent)
  320. {
  321.     var what = "";
  322.  
  323.     if ( !bContent )
  324.     {
  325.         try
  326.         {
  327.             what = getContextHelpRef();
  328.         }
  329.         catch (e)
  330.         {
  331.         }
  332.     }
  333.  
  334.     window.open(window.external.InstallDir + 'help.html' + (what? '#' + what : ''),'help', 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=630px, height=600px, topmargin=10px, leftmargin=10px');
  335. }*/
  336.  
  337. function logPageAccess()
  338. {
  339.     var sLink = getPageLink();
  340.  
  341.     if ( sLink )
  342.         external.CfgRegValueString('last_visited_page') = sLink;
  343. }
  344.  
  345. function getPageLink()
  346. {
  347.     var sPath = window.location + "";
  348.     var arItems = sPath.split("/");
  349.  
  350.     if ( arItems.length > 1)
  351.         return sValidPath = arItems[arItems.length-2] + "/" + arItems[arItems.length-1];
  352.  
  353.     return "";
  354. }
  355.  
  356. function getLastVisitedPage()
  357. {
  358.     return external.CfgRegValueString('last_visited_page');
  359. }
  360.  
  361. function getProtocol( strConstProtocol, strProtNums )
  362. {
  363.     if ( strConstProtocol == 'tcp' )
  364.         return getStr('','STR_PROTOCOL_TCP');
  365.     else if ( strConstProtocol == 'tcp_s' )
  366.         return getStr('','STR_PROTOCOL_TCP_S');
  367.     else if ( strConstProtocol == 'udp' )
  368.         return getStr('','STR_PROTOCOL_UDP');
  369.     else if ( strConstProtocol == 'tcp_udp' )
  370.         return getStr('','STR_PROTOCOL_TCP_UDP');
  371.     else if ( strConstProtocol == 'icmp' )
  372.         return getStr('','STR_PROTOCOL_ICMP');
  373.     else if ( strConstProtocol == 'other' )
  374.         return getStr('','STR_PROTOCOL_OTHER') + (strProtNums? ' (' + strProtNums + ')' : '');
  375.     else if ( strConstProtocol == 'ip' )
  376.         return getStr('','STR_PROTOCOL_IP');
  377.     else
  378.         return strConstProtocol;
  379. }
  380.  
  381. function getProtocolByID( eProtocol, strProtNums, eICMP )
  382. {
  383.     if ( eProtocol == PROT_TCP )
  384.         return getStr('','STR_PROTOCOL_TCP');
  385.     else if ( eProtocol == PROT_TCP_S )
  386.         return getStr('','STR_PROTOCOL_TCP_S');
  387.     else if ( eProtocol == PROT_UDP )
  388.         return getStr('','STR_PROTOCOL_UDP');
  389.     else if ( eProtocol == PROT_TCP_UDP )
  390.         return getStr('','STR_PROTOCOL_TCP_UDP');
  391.     else if ( eProtocol == PROT_ICMP )
  392.         return getStr('','STR_PROTOCOL_ICMP')  + ( eICMP? ' (' + getICMPFncStr( eICMP ) + ')' : '');
  393.     else if ( eProtocol == PROT_OTHER )
  394.         return getStr('','STR_PROTOCOL_OTHER') + (strProtNums? ' (' + strProtNums + ')' : '');
  395.     else if ( eProtocol == PROT_IP )
  396.         return getStr('','STR_PROTOCOL_IP');
  397.     else
  398.         return eProtocol;
  399. }
  400.  
  401. function getProtocolConst( eProt )
  402. {
  403.     if ( eProt == PROT_TCP )
  404.         return 'tcp';
  405.     else if ( eProt == PROT_TCP_S )
  406.         return 'tcp_s';
  407.     else if ( eProt == PROT_UDP )
  408.         return 'udp';
  409.     else if ( eProt == PROT_TCP_UDP )
  410.         return 'tcp_udp';
  411.     else if ( eProt == PROT_ICMP )
  412.         return 'icmp';
  413.     else if ( eProt == PROT_IP )
  414.         return 'ip';
  415.     else if ( eProt == PROT_OTHER )
  416.         return 'other';
  417.     else
  418.         return '*';
  419. }
  420.  
  421. function getDirection( strConstDir )
  422. {
  423.     if ( strConstDir == 'in' )
  424.         return getStr('','STR_DIR_IN');
  425.     else if ( strConstDir == 'out' )
  426.         return getStr('','STR_DIR_OUT')
  427.     else if ( strConstDir == 'in_out' )
  428.         return getStr('','STR_DIR_IN_OUT')
  429.     else
  430.         return strConstDir;
  431. }
  432.  
  433. function getDirectionConst( iDir )
  434. {
  435.     if ( iDir == DIR_IN )
  436.         return 'in';
  437.     else if ( iDir == DIR_OUT )
  438.         return 'out'
  439.     else
  440.         return 'in_out';
  441. }
  442.  
  443. function getPort( strConstPort )
  444. {
  445.     if ( !strConstPort || (strConstPort == 'Any') || (strConstPort == ''))
  446.         return getStr('','STR_PORT_ANY');
  447.     else
  448.         return strConstPort;
  449. }
  450.  
  451. function getICMPFncStr( eICMP )
  452. {
  453.     if ( eICMP == ICMP_ECHO )
  454.         return getStr('fw','STR_ICMP_ECHO');
  455.     else if ( eICMP == ICMP_DEST_UNREACHABLE )
  456.         return getStr('fw','STR_ICMP_DEST_UNREACHABLE');
  457.     else if ( eICMP == ICMP_SRC_QUENCH )
  458.         return getStr('fw','STR_ICMP_SRC_QUENCH');
  459.     else if ( eICMP == ICMP_REDIRECT )
  460.         return getStr('fw','STR_ICMP_REDIRECT');
  461.     else if ( eICMP == ICMP_ROUTER )
  462.         return getStr('fw','STR_ICMP_ROUTER');
  463.     else if ( eICMP == ICMP_TIMEOUT )
  464.         return getStr('fw','STR_ICMP_TIMEOUT');
  465.     else if ( eICMP == ICMP_PARAM )
  466.         return getStr('fw','STR_ICMP_PARAM');
  467.     else if ( eICMP == ICMP_TIMESTAMP )
  468.         return getStr('fw','STR_ICMP_TIMESTAMP');
  469.     else if ( eICMP == ICMP_INFO )
  470.         return getStr('fw','STR_ICMP_INFO');
  471.     else if ( eICMP == ICMP_ADDRMASK )
  472.         return getStr('fw','STR_ICMP_ADDRMASK');
  473.     else if ( eICMP == ICMP_V6_DEST_UNREACHABLE )
  474.         return getStr('fw','STR_ICMP_V6_DEST_UNREACHABLE');
  475.     else if ( eICMP == ICMP_V6_PACKET_TOO_BIG )
  476.         return getStr('fw','STR_ICMP_V6_PACKET_TOO_BIG');
  477.     else if ( eICMP == ICMP_V6_TIMEOUT )
  478.         return getStr('fw','STR_ICMP_V6_TIMEOUT');
  479.     else if ( eICMP == ICMP_V6_PARAM )
  480.         return getStr('fw','STR_ICMP_V6_PARAM');
  481.     else if ( eICMP == ICMP_V6_ECHO )
  482.         return getStr('fw','STR_ICMP_V6_ECHO');
  483.     else if ( eICMP == ICMP_V6_MULTICAST )
  484.         return getStr('fw','STR_ICMP_V6_MULTICAST');
  485.     else if ( eICMP == ICMP_V6_MULTICAST_DONE )
  486.         return getStr('fw','STR_ICMP_V6_MULTICAST_DONE');
  487.     else if ( eICMP == ICMP_V6_ROUTER )
  488.         return getStr('fw','STR_ICMP_V6_ROUTER');
  489.     else if ( eICMP == ICMP_V6_NEIGHBOR )
  490.         return getStr('fw','STR_ICMP_V6_NEIGHBOR');
  491.     else if ( eICMP == ICMP_V6_REDIRECT )
  492.         return getStr('fw','STR_ICMP_V6_REDIRECT');
  493.     else
  494.         return getStr('fw','STR_ICMP_ALL');
  495. }
  496.  
  497. function getICMPFncCode( strICMP )
  498. {
  499.     if ( strICMP == "ECHO_REQ_REPLY_8_0" )
  500.         return ICMP_ECHO;
  501.     else if ( strICMP == "DST_UNREACHABLE_3" )
  502.         return ICMP_DEST_UNREACHABLE;
  503.     else if ( strICMP == "SRC_QUENCH_4" )
  504.         return ICMP_SRC_QUENCH;
  505.     else if ( strICMP == "REDIRECT_5" )
  506.         return ICMP_REDIRECT;
  507.     else if ( strICMP == "ROUTER_ADVERTISMENT_9_10" )
  508.         return ICMP_ROUTER;
  509.     else if ( strICMP == "TIMEOUT_11" )
  510.         return ICMP_TIMEOUT;
  511.     else if ( strICMP == "PARAM_PROBLEM_12" )
  512.         return ICMP_PARAM;
  513.     else if ( strICMP == "TIMESTAMP_REQ_REPLY_13_14" )
  514.         return ICMP_TIMESTAMP;
  515.     else if ( strICMP == "INFO_REQ_REPLY_15_16" )
  516.         return ICMP_INFO;
  517.     else if ( strICMP == "ADDRMASK_REQ_REPLY_17_18" )
  518.         return ICMP_ADDRMASK;
  519.     else if ( strICMP == "V6_DST_UNREACHABLE_1" )
  520.         return ICMP_V6_DEST_UNREACHABLE;
  521.     else if ( strICMP == "V6_PACKET_TOO_BIG_2" )
  522.         return ICMP_V6_PACKET_TOO_BIG;
  523.     else if ( strICMP == "V6_TIME_EXCEEDED_3" )
  524.         return ICMP_V6_TIMEOUT;
  525.     else if ( strICMP == "V6_PARAM_PROBLEM_4" )
  526.         return ICMP_V6_PARAM;
  527.     else if ( strICMP == "V6_ECHO_REQ_REPLY_128_129" )
  528.         return ICMP_V6_ECHO;
  529.     else if ( strICMP == "V6_MULTICAST_LISTENER_130_131" )
  530.         return ICMP_V6_MULTICAST;
  531.     else if ( strICMP == "V6_MULTICAST_LISTENER_DONE_132" )
  532.         return ICMP_V6_MULTICAST_DONE;
  533.     else if ( strICMP == "V6_ROUTER_ADVERTISMENT_133_134" )
  534.         return ICMP_V6_ROUTER;
  535.     else if ( strICMP == "V6_NEIGHBOR_ADVERTISMENT_135_136" )
  536.         return ICMP_V6_NEIGHBOR;
  537.     else if ( strICMP == "V6_REDIRECT_137" )
  538.         return ICMP_V6_REDIRECT;
  539.     else
  540.         return ICMP_ALL;
  541. }
  542.  
  543. function showhide(helpspan)
  544. {
  545.     var obj = getObj(helpspan).style;
  546.     if (obj.display== 'none')
  547.         obj.display = 'block';
  548.     else
  549.         obj.display = 'none';
  550. }
  551.  
  552. //////////////////////////////////////////////////////////////////////////////////////
  553. // GetApplicationsComboHtmlString - creates the application selection combo (uses app-list.xsl)
  554. //
  555. // CHANGED (by MM)! Parameters strServerPath and strClientPath are used only for identification if server or client
  556. // database should be used.
  557. function GetApplicationsComboHtmlString( strCtrlID, strServerPath, bClientPath, bIncludeDlls, bNoGroups, bNoLabels,
  558.     bSkipSysApps, bDivide, bDisplayByDesc, bShowInfo, strOnChange, strOnDeactivate, bAddNoChangeRow, strStyle, bNotAll )
  559. {
  560.     // compose the parameters passed into XSLT
  561.     var strXslParams = bNoGroups ? '&groups=0' : '&groups=1';
  562.     strXslParams += bNoLabels ? '&labels=0' : '&labels=1';
  563.     strXslParams += bSkipSysApps ? '&skipsysapps=1' : '&skipsysapps=0';
  564.     strXslParams += bDivide ? '÷=1' : '÷=0';
  565.     strXslParams += bDisplayByDesc ? '&field=desc' : '&field=id';
  566.     strXslParams += bShowInfo ? '&info=1' : '&info=0';
  567.  
  568.     // add strings params
  569.     strXslParams += '&str_opt_sel_app=' + getStr('','STR_OPT_SEL_APP');
  570.     strXslParams += '&str_opt_sel_grp=' + getStr('','STR_OPT_SEL_GRP');
  571.     strXslParams += '&str_opt_sel_grp_dll=' + getStr('','STR_OPT_SEL_GRP_DLL');
  572.     strXslParams += '&str_opt_sel_dll=' + getStr('','STR_OPT_SEL_DLL');
  573.  
  574.     var strAppsHTML = '<select ' + (strStyle? strStyle : 'style="width: 400px"') + ' NAME="' + strCtrlID + '" ID="' + strCtrlID + '" ' + (strOnDeactivate?(' ondeactivate="'+ strOnDeactivate + '"'):'') + (strOnChange?(' onchange="' + strOnChange + '"'):'') + '>';
  575.  
  576.     if ( bAddNoChangeRow )
  577.         strAppsHTML += '<option value="" selected>' + getStr('','STR_BTCH_NO_CHANGE') + '</option>';
  578.  
  579.     // to distinguish fast among label and group, a: resp. g: prefix is added to the option values (d: and h: for dlls)
  580.  
  581.     if (bIncludeDlls)    // only in DLL Loading, dlls can be included in the combo
  582.     {
  583.         // * => all dlls
  584.         if ( !bNotAll )
  585.             strAppsHTML += '<option value="d:*">' + getStr('','STR_OPT_SEL_ALL_DLL') + '</option>';
  586.  
  587.         // client repository
  588.           if (bClientPath) // && isCPVisible())
  589.           {
  590.             strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_USER_REP') + '</option>';
  591.             strAppsHTML += transformXMLWithParamsEx( XM_APPREP, true, "../ws/app-list.xsl", strXslParams + "&mode=dlllist" );
  592.             strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_COMMON_REP') + '</option>';
  593.         }
  594.  
  595.         // server repository
  596.         strAppsHTML += transformXMLWithParamsEx( XM_APPREP, false, "../ws/app-list.xsl", strXslParams + "&mode=dlllist");
  597.  
  598.         // * => all apps
  599.         strAppsHTML += '<option value="a:*">' + getStr('','STR_OPT_SEL_ALL_APP') + '</option>';
  600.  
  601.     } else {
  602.  
  603.         // * => all apps
  604.         if ( !bNotAll )
  605.             strAppsHTML += '<option value="a:*">*</option>';
  606.     }
  607.  
  608.     strXslParams += "&mode=applist";
  609.  
  610.     // client repository
  611.     if (bClientPath) //&& isCPVisible())
  612.     {
  613.         strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_USER_REP') + '</option>';
  614.         strAppsHTML += transformXMLWithParamsEx( XM_APPREP, true, "../ws/app-list.xsl", strXslParams );
  615.         strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_COMMON_REP') + '</option>';
  616.     }
  617.  
  618.     // $* => all system apps
  619.     //strAppsHTML += '<option value="a:$*">$* (system)</option>';
  620.  
  621.     // server repository
  622.     strAppsHTML += transformXMLWithParamsEx( XM_APPREP, false, "../ws/app-list.xsl", strXslParams + (isPersonalVersion()? "&removespec=1" : ""));
  623.  
  624.     strAppsHTML += '</select>';
  625.  
  626.     return strAppsHTML;
  627. }
  628.  
  629. function GetApplicationsListHtmlString( strCtrlID, bClientPath, bIncludeDlls, bNoGroups, bNoLabels,
  630.     bSkipSysApps, bDivide, bDisplayByDesc, bShowInfo, strOnChange, strOnDeactivate, strOnDblClick, bAddNoChangeRow, strStyle, bNotAll, iSize )
  631. {
  632.     // compose the parameters passed into XSLT
  633.     var strXslParams = bNoGroups ? '&groups=0' : '&groups=1';
  634.     strXslParams += bNoLabels ? '&labels=0' : '&labels=1';
  635.     strXslParams += bSkipSysApps ? '&skipsysapps=1' : '&skipsysapps=0';
  636.     strXslParams += bDivide ? '÷=1' : '÷=0';
  637.     strXslParams += bDisplayByDesc ? '&field=desc' : '&field=id';
  638.     strXslParams += bShowInfo ? '&info=1' : '&info=0';
  639.  
  640.     // add strings params
  641.     strXslParams += '&str_opt_sel_app=' + getStr('','STR_OPT_SEL_APP');
  642.     strXslParams += '&str_opt_sel_grp=' + getStr('','STR_OPT_SEL_GRP');
  643.     strXslParams += '&str_opt_sel_grp_dll=' + getStr('','STR_OPT_SEL_GRP_DLL');
  644.     strXslParams += '&str_opt_sel_dll=' + getStr('','STR_OPT_SEL_DLL');
  645.  
  646.     var strAppsHTML = '<select ' + (strOnDblClick? 'ondblclick="' + strOnDblClick + '"' : '' ) + ' size="' + iSize + '" ' + (strStyle? strStyle : 'style="width: 400px"') + ' NAME="' + strCtrlID + '" ID="' + strCtrlID + '" ' + (strOnDeactivate?(' ondeactivate="'+ strOnDeactivate + '"'):'') + (strOnChange?(' onchange="' + strOnChange + '"'):'') + '>';
  647.  
  648.     if ( bAddNoChangeRow )
  649.         strAppsHTML += '<option value="" selected>' + getStr('','STR_BTCH_NO_CHANGE') + '</option>';
  650.  
  651.     // to distinguish fast among label and group, a: resp. g: prefix is added to the option values (d: and h: for dlls)
  652.  
  653.     if (bIncludeDlls)    // only in DLL Loading, dlls can be included in the combo
  654.     {
  655.         // * => all dlls
  656.         if ( !bNotAll )
  657.             strAppsHTML += '<option value="d:*">' + getStr('','STR_OPT_SEL_ALL_DLL') + '</option>';
  658.  
  659.         // client repository
  660.           if (bClientPath)
  661.           {
  662.               //strAppsHTML += '<optgroup label="' + getStr('','STR_OPT_SEL_USER_REP') + '">';
  663.             strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_USER_REP') + '</option>';
  664.             strAppsHTML += transformXMLWithParamsEx( XM_APPREP, true, "../ws/app-list.xsl", strXslParams + "&mode=dlllist" );
  665.             //strAppsHTML += '</optgroup>';
  666.  
  667.             //strAppsHTML += '<optgroup label="' + getStr('','STR_OPT_SEL_COMMON_REP') + '">';
  668.             strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_COMMON_REP') + '</option>';
  669.         }
  670.  
  671.         // server repository
  672.         strAppsHTML += transformXMLWithParamsEx( XM_APPREP, false, "../ws/app-list.xsl", strXslParams + "&mode=dlllist");
  673.  
  674.         if (bClientPath)
  675.         {
  676.             //strAppsHTML += '</optgroup>';
  677.         }
  678.  
  679.         // * => all apps
  680.         strAppsHTML += '<option value="a:*">' + getStr('','STR_OPT_SEL_ALL_APP') + '</option>';
  681.  
  682.     } else {
  683.  
  684.         // * => all apps
  685.         if ( !bNotAll )
  686.             strAppsHTML += '<option value="a:*">*</option>';
  687.     }
  688.  
  689.     strXslParams += "&mode=applist";
  690.  
  691.     // client repository
  692.     if (bClientPath) //&& isCPVisible())
  693.     {
  694.         strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_USER_REP') + '</option>';
  695.         //strAppsHTML += '<optgroup label="' + getStr('','STR_OPT_SEL_USER_REP') + '">';
  696.         strAppsHTML += transformXMLWithParamsEx( XM_APPREP, true, "../ws/app-list.xsl", strXslParams );
  697.         //strAppsHTML += '</optgroup>';
  698.  
  699.         //strAppsHTML += '<optgroup label="' + getStr('','STR_OPT_SEL_COMMON_REP') + '">';
  700.         strAppsHTML += '<option value="" style="color: ' + COLOR_DB_ROW + ';">' + getStr('','STR_OPT_SEL_COMMON_REP') + '</option>';
  701.     }
  702.  
  703.     // server repository
  704.     strAppsHTML += transformXMLWithParamsEx( XM_APPREP, false, "../ws/app-list.xsl", strXslParams + (isPersonalVersion()? "&removespec=1" : ""));
  705.  
  706.     if (bClientPath)
  707.     {
  708.         //strAppsHTML += '</optgroup>';
  709.     }
  710.  
  711.     strAppsHTML += '</select>';
  712.  
  713.     return strAppsHTML;
  714. }
  715.  
  716.  
  717. //========================== menu ====================================
  718. var hTimeout = 0;
  719. var sTimeoutCommand = "";
  720. var _m_lastMenuLayer = '';
  721. function popUpLayer(sLayerName,bShow, oParent)
  722. {
  723.     if (bShow)
  724.     {
  725.         doTimeoutCommand();
  726.  
  727.         document.getElementById(sLayerName).style.top = (topmenu.offsetTop + topmenu.offsetHeight - 2) + "px";
  728.         document.getElementById(sLayerName).style.left = (oParent.offsetLeft + 8 ) + "px";
  729.  
  730.         document.getElementById('_menu_tmp_frame').style.top = (topmenu.offsetTop + topmenu.offsetHeight - 2) + "px";
  731.         document.getElementById('_menu_tmp_frame').style.left = (oParent.offsetLeft + 8 ) + "px";
  732.         document.getElementById('_menu_tmp_frame').style.height = document.getElementById(sLayerName).offsetHeight + "px";
  733.         document.getElementById('_menu_tmp_frame').style.width = document.getElementById(sLayerName).offsetWidth + "px";
  734.  
  735.         _m_lastMenuLayer = sLayerName;
  736.     }
  737.     else
  738.         _m_lastMenuLayer = '';
  739.  
  740.     document.getElementById(sLayerName).style.visibility = (bShow? "visible" : "hidden");
  741.     document.getElementById('_menu_tmp_frame').style.visibility = (bShow? "visible" : "hidden");
  742. }
  743.  
  744. // Sets timer for floating menu hiding
  745. // @param sLayerName is name of the layer to hide
  746. function layerTimeOff(sLayerName)
  747. {
  748.     sTimeoutCommand = "popUpLayer('" + sLayerName + "', false)";
  749.     hTimeout = setTimeout(sTimeoutCommand, 200);
  750. }
  751.  
  752. // Immediately performs timeout command
  753. function doTimeoutCommand()
  754. {
  755.     if (sTimeoutCommand)
  756.     {
  757.         eval(sTimeoutCommand);
  758.         clearTimeout(hTimeout);
  759.         sTimeoutCommand = "";
  760.     }
  761. }
  762.  
  763. // Show menu
  764. function onMenuItemOver()
  765. {
  766.     clearTimeout(hTimeout);
  767. }
  768.  
  769. // Hide manu
  770. function onMenuItemOut(sLayerName)
  771. {
  772.     layerTimeOff(sLayerName);
  773. }
  774.  
  775. function addSubMenuItem( strText, strLink, strOnClick)
  776. {
  777.     document.write('<a href="' + strLink  + '" ' + (strOnClick? 'onclick="' + strOnClick + '"' : '') + '><span style="color: black">::</span>' + strText + '</a>')
  778. }
  779.  
  780. function addTopMenuItem( strText, strSubMenuID, strOnClick, strLink)
  781. {
  782.     document.write('<a ' + (strSubMenuID? 'onmouseout="layerTimeOff(\'' + strSubMenuID + '\'); return false;" onmouseover="popUpLayer(\'' + strSubMenuID + '\',true, this);"' : '') + ' href="' + (strLink? strLink : '#') + '" ' + (strLink? '' : 'onclick="' + ( strOnClick? strOnClick : '') + '"' ) + '>' + strText + '</a>')
  783. }
  784.  
  785. function showOptionDialog()
  786. {
  787.     // hide current menu
  788.     if ( external.CfgRegValueString("design") == 'std_menu' )
  789.         popUpLayer(_m_lastMenuLayer,false, null);
  790.  
  791.     var arParams = new Array();
  792.  
  793.     arParams[0] = external;
  794.     arParams[1] = window;
  795.  
  796.     var sFeatures="dialogHeight: 445px; dialogWidth: 610px; help:no; status:no; resizable:no; center:yes;";
  797.  
  798.     window.showModalDialog( '../common/options.html', arParams, sFeatures );
  799. }
  800.  
  801. function insertTopMenu()
  802. {
  803.     var bADSupportInstalled = isUmxUTAInstalled();
  804.  
  805.     //alert( document.body.offsetWidth )
  806.     //alert( document.body.scrollWidth )
  807.     document.write('<style>')
  808.         document.write('DIV#topmenu A, DIV#topmenu A:hover, DIV#topmenu A:visible {background-image: url(../img/arrow_orange.gif); background-position: -3px; background-repeat: no-repeat; text-decoration: none; color: #FAC114; font-weight: bold; border: 0px; padding: 2px 1px 2px 10px; margin: 1px 2px 1px 5px;}');
  809.         document.write('DIV#topmenu A:hover {background-image: url(../img/arrow.gif); color: white;}');
  810.         document.write('DIV#topmenu { font-size: 8pt; width: 100%; white-space: nowrap; margin-top: 0px; height: 18px; border: 0px; border-bottom: 2px solid #66ccff; padding-bottom: 1px; background-image: url(../img/menu_bg.gif); }');
  811.  
  812.         document.write('DIV.submenu { font-size: 8pt; position: absolute; visibility: hidden; z-index: 500; top: 97px; left: 200px; padding: 5px 3px 5px 3px; background: White; border: 1px solid #25478F; border-right-width: 2px; border-bottom-width: 2px; filter: Alpha(Opacity=90); }');
  813.         document.write('DIV.submenu A{ display: block; font-weight: bold; color: #25478F; text-decoration: none; text-align: left; padding: 0px 5px 0px 5px; white-space: nowrap; border: 1px solid white; }');
  814.         document.write('DIV.submenu A:hover { background-color: #DFEBFF; border: 1px solid #25478F; color: black;}');
  815.     document.write('</style>')
  816.  
  817.     document.write('<iframe id="_menu_tmp_frame" style="visibility: hidden; position: absolute; filter: Alpha(Opacity=30);"></iframe>');
  818.  
  819.     document.write('<div style="z-index=-1; border-bottom: 2px solid #66ccff; position: absolute; left: 0px; top: 0px; margin-left: 0px; width: 13px; height: 18px; background-image: url(../img/menu_bg.gif);"></div>')
  820.     document.write('<div style="z-index=-1; border-bottom: 2px solid #66ccff; position: absolute; left: 39px; top: 0px; margin-left: 0px; width: 100%; height: 18px; background-image: url(../img/menu_bg.gif);"></div>')
  821.  
  822.     document.write('<div id="topmenu">')
  823.  
  824.         if ( external.ServerParser(0x40) )
  825.             addTopMenuItem( getStr('','STR_LMENU_APPLICATIONS'), '_appmenu');
  826.  
  827.         // firewall
  828.         if ( external.ServerParser(2) )
  829.         {
  830.             if ( isServerOS() && !isManaged() && isProVersion() )
  831.             {
  832.                 // normal rules
  833.                 addTopMenuItem( getStr('','STR_LMENU_LTRAFFIC'), '_fwmenu');
  834.  
  835.                 // routed rules
  836.                 addTopMenuItem( getStr('','STR_LMENU_PASS_TROUGH'), '_fwmenu2');
  837.             }
  838.             else
  839.                 addTopMenuItem( getStr('','STR_LMENU_FW_PROT'), '_fwmenu');
  840.  
  841.             if ( isContentFilterVisible() )
  842.             {
  843.                 if ( isProVersion() && !isManaged() )
  844.                     addTopMenuItem( getStr('','STR_LMENU_CONT_FILTER'), '_httpfiltermenu');
  845.             }
  846.         };
  847.  
  848.         // sandbox
  849.         if ( external.ServerParser(1) )
  850.         {
  851.             addTopMenuItem( getStr('','STR_LMENU_WS_FILE_PROT'), '_filemenu');
  852.  
  853.             addTopMenuItem( getStr('','STR_LMENU_WS_PROT2'), '_sysmenu');
  854.             //addTopMenuItem( getStr('','STR_LMENU_WS_PROT'), '_sysmenu');
  855.         }
  856.  
  857.         // IDS/IPS
  858.         if ( external.ServerParser(0x10) )
  859.             addTopMenuItem( getStr('','STR_LMENU_IDS'), '_idsmenu');
  860.  
  861.         // setting
  862.         addTopMenuItem( getStr('','STR_LMENU_SETTINGS'), '_setmenu');
  863.  
  864.         // reports
  865.         addTopMenuItem( getStr('','STR_LMENU_REPORTS'), '', '', '../reports/logs.html' );
  866.  
  867.         // help
  868.         addTopMenuItem( getStr('','STR_LMENU_HELP'), '', 'javascript:showhelp(true); return false;');
  869.  
  870.     document.write('</div>')
  871.  
  872.     document.write('<div class="submenu" id="_appmenu" onmouseout="onMenuItemOut(\'_appmenu\');" onmouseover="onMenuItemOver();">');
  873.  
  874.             addSubMenuItem( getStr('','STR_LMENU_APPLICATIONS_LEAF'), '../apprep/arn-list.html' )
  875.             if ( external.ServerParser(1) )
  876.                 addSubMenuItem( getStr('','STR_LMENU_WS_APP_SPAWNCON'), '../ws/wsn-spawn-rules.html');
  877.  
  878.     document.write('</div>')
  879.  
  880.     document.write('<div class="submenu" id="_fwmenu" onmouseout="onMenuItemOut(\'_fwmenu\');" onmouseover="onMenuItemOver();">');
  881.  
  882.             // firewall
  883.             if ( external.ServerParser(2) )
  884.             {
  885.                 var iZones = 1;//FW_GetPropertyValue("ZoneMode");
  886.                 if ( isNaN(parseInt(iZones)) ) // property not defined
  887.                     iZones = ZM_LOCAL_CONTROL; // default value
  888.  
  889.                 var bShowZonesCtrl = ( iZones == ZM_LOCAL_CONTROL);
  890.  
  891.                 if ( isServerOS() && !isManaged() && isProVersion() )
  892.                 {
  893.                     // normal rules
  894.                     addSubMenuItem( getStr('','STR_LMENU_ENDPOINT'), '../firewall/fwn-rules-list-detail.html' )
  895.  
  896.                     if ( bADSupportInstalled )
  897.                     {
  898.                         addSubMenuItem( getStr('','STR_LMENU_VPN_LAN_USERS'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=fwRulesListUser\';')
  899.                         //addSubMenuItem( getStr('','STR_LMENU_VPN_USERS'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=fwRulesListUser\';')
  900.                         //addSubMenuItem( getStr('','STR_LMENU_MY_NET_USERS'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=fwRulesListUserLAN\';')
  901.                         addSubMenuItem( getStr('','STR_LMENU_PROTOCOL_VIEW'), '../firewall/fwn-vpn-protocol-view.html', 'external.CfgRegValueString(\'fwn-vpn-protocol-view.html_params\') = \'?mode=normal\';' )
  902.                     }
  903.                     addSubMenuItem( getStr('','STR_LMENU_ZONE'), '../firewall/fwn-zones.html' )
  904.                 }
  905.                 else if ( isProVersion() && !isManaged() )
  906.                 {
  907.                     addSubMenuItem( getStr('','STR_LMENU_FW_LOCAL_RULES'), '../firewall/fwn-rules-list-detail.html' )
  908.                     addSubMenuItem( getStr('','STR_LMENU_FW_ROUTED_RULES'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=list\';')
  909.                     addSubMenuItem( getStr('','STR_LMENU_ZONE'), '../firewall/fwn-zones.html' )
  910.                     addSubMenuItem( getStr('','STR_LMENU_NAT_ICS'), '../firewall/fwn-nat-options.html' )
  911.                     addSubMenuItem( getStr('','STR_LMENU_PROTOCOLS'), '../firewall/fwn-transport.html' )
  912.                     addSubMenuItem( getStr('','STR_LMENU_PRE_IP'), '../firewall/fwn-ipaddr.html' )
  913.                 }
  914.                 else
  915.                 {
  916.                     addSubMenuItem( getStr('','STR_LMENU_NET_SEC_RULES'), '../firewall/fwn-rules-list-detail.html' )
  917.  
  918.                     if ( bShowZonesCtrl || !isManaged() )
  919.                         addSubMenuItem( getStr('','STR_LMENU_ZONE'), '../firewall/fwn-zones.html' )
  920.  
  921.                     addSubMenuItem( getStr('','STR_LMENU_PROTOCOLS'), '../firewall/fwn-transport.html' )
  922.                     addSubMenuItem( getStr('','STR_LMENU_PRE_IP'), '../firewall/fwn-ipaddr.html' )
  923.                 }
  924.             };
  925.  
  926.     document.write('</div>')
  927.  
  928.     document.write('<div class="submenu" id="_fwmenu2" onmouseout="onMenuItemOut(\'_fwmenu2\');" onmouseover="onMenuItemOver();">');
  929.  
  930.             // firewall
  931.             // routed rules
  932.             addSubMenuItem( getStr('','STR_LMENU_ENDPOINT'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=list\';')
  933.  
  934.             if ( bADSupportInstalled )
  935.             {
  936.                 addSubMenuItem( getStr('','STR_LMENU_VPN_USERS'), '../firewall/fwn-vpn-rules-list-detail.html','external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=userrulelist\';' )
  937.                 addSubMenuItem( getStr('','STR_LMENU_MY_NET_USERS'), '../firewall/fwn-vpn-rules-list-detail.html', 'external.CfgRegValueString(\'fwn-vpn-rules-list-detail.html_params\') = \'?mode=userrulelist_out\';' )
  938.                 addSubMenuItem( getStr('','STR_LMENU_PROTOCOL_VIEW'), '../firewall/fwn-vpn-protocol-view.html', 'external.CfgRegValueString(\'fwn-vpn-protocol-view.html_params\') = \'?mode=routed\';')
  939.             }
  940.             addSubMenuItem( getStr('','STR_LMENU_NAT_ICS'), '../firewall/fwn-nat-options.html' )
  941.  
  942.     document.write('</div>')
  943.  
  944.     document.write('<div class="submenu" id="_httpfiltermenu" onmouseout="onMenuItemOut(\'_httpfiltermenu\');" onmouseover="onMenuItemOver();">');
  945.  
  946.             addSubMenuItem(getStr('','STR_LMENU_EXPRULES'), '../httpfilter/hf-rules.html');
  947.             addSubMenuItem(getStr('','STR_LMENU_PREDEF'), '../httpfilter/hf-objects-list.html');
  948.  
  949.     document.write('</div>')
  950.  
  951.     document.write('<div class="submenu" id="_setmenu" onmouseout="onMenuItemOut(\'_setmenu\');" onmouseover="onMenuItemOver();">');
  952.  
  953.             if ( external.ServerParser(2) && isServerOS() && isProVersion() && !isManaged() )
  954.             {
  955.                 addSubMenuItem( getStr('','STR_LMENU_PROTOCOLS'), '../firewall/fwn-transport.html' )
  956.                 addSubMenuItem( getStr('','STR_LMENU_PRE_IP'), '../firewall/fwn-ipaddr.html' )
  957.             }
  958.  
  959.             if ( external.ServerParser(2) || external.ServerParser(1) )
  960.                 addSubMenuItem( getStr('','STR_LMENU_TIME'), '../common/daytime.html' )
  961.  
  962.             addSubMenuItem( getStr('','STR_LMENU_BACKUP'), 'javascript:window.external.OpenBackupDlg(); location.reload();' )
  963.             addSubMenuItem( getStr('','STR_LMENU_WS_OPTIONS'), '#', 'showOptionDialog(); return false;' )
  964.  
  965. /*            if ( external.ServerParser(2) && isServerOS() && bADSupportInstalled && isProVersion() && !isManaged() )
  966.                 addSubMenuItem( getStr('','STR_LMENU_AD_SETTING'), '../common/options_ad.html' )*/
  967.  
  968.             if ( isProVersion() )
  969.                 addSubMenuItem( getStr('','STR_LMENU_OPTIONS_TRACK'), '../common/options_track.html' )
  970.  
  971.     document.write('</div>')
  972.  
  973.     document.write('<div class="submenu" id="_idsmenu" onmouseout="onMenuItemOut(\'_idsmenu\');" onmouseover="onMenuItemOver();">');
  974.  
  975.             addSubMenuItem( getStr('','STR_LMENU_IDS_RULES'), '../ids/ids-rules.html' )
  976.             addSubMenuItem( getStr('','STR_LMENU_IDS_IP'), '../ids/ids-ipaddr.html' )
  977.  
  978.     document.write('</div>')
  979.  
  980.     document.write('<div class="submenu" id="_filemenu" onmouseout="onMenuItemOut(\'_filemenu\');" onmouseover="onMenuItemOver();">');
  981.  
  982.  
  983.             if ( !isManaged() )
  984.             {
  985.                 if ( isProVersion() )
  986.                 {
  987.                     addSubMenuItem(getStr('','STR_LMENU_SIMPLERULES'), '../ws/wsn-files-rules-simple.html');
  988.                 }
  989.                 else
  990.                 {
  991.                     addSubMenuItem(getStr('','STR_LMENU_WS_FILE_PROT_HIDDEN'), '../ws/wsn-files-hidden.html');
  992.                     addSubMenuItem(getStr('','STR_LMENU_WS_FILE_PROT_RO'), '../ws/wsn-files-readonly.html');
  993.                 }
  994.             }
  995.  
  996.             addSubMenuItem(getStr('','STR_LMENU_EXPRULES'), '../ws/wsn-files-rules.html');
  997.  
  998.     document.write('</div>')
  999.  
  1000.     document.write('<div class="submenu" id="_sysmenu" onmouseout="onMenuItemOut(\'_sysmenu\');" onmouseover="onMenuItemOver();">');
  1001.  
  1002.             addSubMenuItem(getStr('','STR_LMENU_WS_REG'), '../ws/wsn-registry-rules.html');
  1003.             if ( !is64bitOS() )
  1004.                 addSubMenuItem(getStr('','STR_LMENU_WS_DLL_LOAD'), '../ws/wsn-spawndll-rules.html');
  1005.             addSubMenuItem(getStr('','STR_LMENU_WS_OLE_COM_CTRL'), '../ws/wsn-olecom-rules.html');
  1006.             addSubMenuItem(getStr('','STR_LMENU_WS_SERVICES_CTRL'), '../ws/wsn-services-rules.html');
  1007.             addSubMenuItem(getStr('','STR_LMENU_WS_DEV_CTRL'), '../ws/wsn-devices.html');
  1008.             addSubMenuItem(getStr('','STR_LMENU_WS_SYS_PRIV'), '../ws/wsn-syspriv-rules.html');
  1009.             addSubMenuItem(getStr('','STR_LMENU_WS_EXCEPTIONS'), '../ws/wsn-except-rules.html');
  1010.  
  1011.     document.write('</div>')
  1012. }
  1013.  
  1014. function insertStyleFiles()
  1015. {
  1016.     document.write('<link href="../common/styl.css" rel="stylesheet" type="text/css">');
  1017.     if ( external.CfgRegValueString("design") == 'bt_menu')
  1018.     {
  1019.         document.write('<link href="../layout-bt/styl.css" rel="stylesheet" type="text/css">');
  1020.     }
  1021. }
  1022.  
  1023. function processMsgOKNotShow(strRegKey, strText, strNotShowText, strTitle)
  1024. {
  1025.     var strValue = external.CfgRegValueString( strRegKey );
  1026.  
  1027.     if ( strValue == 'not_show')
  1028.         return;
  1029.  
  1030.     var arParams = new Array();
  1031.  
  1032.     arParams[0] = external;
  1033.     arParams[1] = strText;
  1034.     arParams[2] = strNotShowText;
  1035.     arParams[3] = strTitle;
  1036.  
  1037.     var sFeatures="dialogHeight: 200px; dialogWidth: 370px; help:no; status:no; resizable:no; center:yes;";
  1038.  
  1039.     var arRetVal = window.showModalDialog( '../common/msgbox.html', arParams, sFeatures );
  1040.  
  1041.     if ( arRetVal && arRetVal[0] )
  1042.     {
  1043.         external.CfgRegValueString( strRegKey ) = 'not_show';
  1044.     }
  1045. }
  1046.  
  1047. ////////////////////////// Table header //////////////////////
  1048.  
  1049. /*
  1050. iCorrection - is needed when table has not collapsed border. Then
  1051. is there space between cells (usual 2px).
  1052. */
  1053. function initTblHeader( strHdrWrapperID, strRulesID, iCorrection)
  1054. {
  1055.     if ( !iCorrection )
  1056.         iCorrection = 0;
  1057.  
  1058.     var oDivContainer = getObj(strHdrWrapperID);
  1059.     var oData = getObj(strRulesID);
  1060.     if ( !oData ) // table not found
  1061.         return;
  1062.  
  1063.     var oDataRow = oData.rows[0];
  1064.     var oDataRowLast = null;
  1065.  
  1066.     // get last not empty row
  1067.     for (var i = oData.rows.length - 1; i >= 0; i-- )
  1068.     {
  1069.         if ( oData.rows[i].cells.length == oDataRow.cells.length )
  1070.         {
  1071.             oDataRowLast = oData.rows[i];
  1072.             break;
  1073.         }
  1074.     }
  1075.  
  1076.     // for sure
  1077.     if ( !oDataRowLast )
  1078.         return;
  1079.  
  1080.     // remove current table header
  1081.     while ( oDivContainer.childNodes.length > 0 )
  1082.         oDivContainer.removeChild( oDivContainer.childNodes[0] );
  1083.  
  1084.     for (var i = 0; i < oDataRow.cells.length; i++ )
  1085.     {
  1086.         var oDataCell = oDataRow.cells[i];
  1087.         var oDataCellLast = oDataRowLast.cells[i];
  1088.  
  1089.         oDiv = document.createElement('DIV')
  1090.         oDiv.innerHTML = oDataCell.innerHTML;
  1091.  
  1092.         if ( i == 0)
  1093.             oDiv.style.width = (oDataCellLast.offsetWidth + 1 + iCorrection) + "px";
  1094.         else if ( i == oDataRow.cells.length - 1)
  1095.             oDiv.style.width = (oDataCellLast.offsetWidth + 20 + iCorrection) + "px";
  1096.         else
  1097.             oDiv.style.width = (oDataCellLast.offsetWidth + iCorrection) + "px";
  1098.  
  1099.         oDivContainer.appendChild( oDiv);
  1100.     }
  1101.  
  1102.     oData.style.marginTop = '-' + (oDataRow.offsetHeight + 1) + 'px';
  1103. }
  1104.  
  1105. function scrollTblHeader(strHdrWrapperID, strRulesWrapperID)
  1106. {
  1107.     var oDiv = getObj(strRulesWrapperID);
  1108.     var oDivContainer = getObj(strHdrWrapperID);
  1109.  
  1110.     oDivContainer.scrollLeft = oDiv.scrollLeft;
  1111. }
  1112.  
  1113. // autofit dialog height
  1114. var _posCorrLeft = 0;
  1115. var _posCorrTop = 0;
  1116.  
  1117. function _autofitDialogSize(bWidth, bHeight)
  1118. {
  1119.     if ( !_posCorrLeft )
  1120.         _posCorrLeft = window.screenLeft - parseInt(window.dialogLeft);
  1121.  
  1122.     if ( !_posCorrTop )
  1123.         _posCorrTop = window.screenTop - parseInt(window.dialogTop);
  1124.  
  1125.     var leftPos = window.screenLeft;
  1126.     var topPos = window.screenTop;
  1127.  
  1128.     window.dialogLeft = leftPos - _posCorrLeft;
  1129.     window.dialogTop = topPos - _posCorrTop;
  1130.  
  1131.     if ( bHeight )
  1132.         window.dialogHeight = (document.body.scrollHeight + parseInt(window.dialogHeight) - parseInt(document.body.offsetHeight)) + "px";
  1133. }
  1134.  
  1135. function getAccessImg( eAccess )
  1136. {
  1137.     if ( eAccess == AR_PREVENT )
  1138.         return '<img src="../img/prevent.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_PREVENT') + '">';
  1139.     else if ( eAccess == AR_ASKUSER )
  1140.         return '<img src="../img/askuser.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_ASK') + '">';
  1141.     else
  1142.         return '<img src="../img/allow.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_ALLOW') + '">';
  1143. }
  1144.  
  1145. function getAuditImg( eAudit )
  1146. {
  1147.     if ( eAudit == AL_MONITOR )
  1148.         return '<img src="../img/monitor.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_MONITOR') + '">';
  1149.     else if ( eAudit == AL_ALERT )
  1150.         return '<img src="../img/alert.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_ALERT') + '">';
  1151.     else
  1152.         return '<img src="../img/ignore.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_IGNORE') + '">';
  1153. }
  1154.  
  1155. function getAccessImgByStr( strAccess )
  1156. {
  1157.     if ( strAccess == 'Prevent' )
  1158.         return '<img src="../img/prevent.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_PREVENT') + '">';
  1159.     else if ( strAccess == 'AskUser' )
  1160.         return '<img src="../img/askuser.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_ASK') + '">';
  1161.     else
  1162.         return '<img src="../img/allow.gif" width="16" height="16" title="' + getStr('','STR_ACCESS_ALLOW') + '">';
  1163. }
  1164.  
  1165. function getAuditImgByStr( strAudit )
  1166. {
  1167.     if ( strAudit == 'Monitor' )
  1168.         return '<img src="../img/monitor.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_MONITOR') + '">';
  1169.     else if ( strAudit == 'Alert' )
  1170.         return '<img src="../img/alert.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_ALERT') + '">';
  1171.     else
  1172.         return '<img src="../img/ignore.gif" width="16" height="16" title="' + getStr('','STR_AUDIT_IGNORE') + '">';
  1173. }
  1174.